<?php
/**
 * Author: 孙武 QQ:1228746736
 * Date: 2017/12/4
 * Time: 22:46
 */
function sentMail($to, $title, $body)
{
    require_once "./PHPMailer/PHPMailerAutoload.php";
    $mail = new PHPMailer;

    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'smtp.qq.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = '1228746736@qq.com';                 // SMTP username
    $mail->Password = 'gxulvdvgiipxjhic';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to

    $mail->setFrom('1228746736@qq.com', '孙武');
    $mail->addAddress($to);               // Name is optional
    $mail->isHTML(true);                                  // Set email format to HTML

    $mail->Subject = $title;
    $mail->Body = $body;

    if (!$mail->send()) {
        var_dump($mail->ErrorInfo);
    } else {
       echo "发送成功";
    }
}

for($i=0;$i<50;$i++){
    sentMail('3380831562@qq.com','sssss','34444'.$i);
}